﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Profile.aspx.vb" Inherits="Week3Wscc.Profile" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .emptypng { background-image: url("pictures/misc/rating_icon.png"); width: 25px; height: 28px; }
        .ratingpng { background-image: url("pictures/misc/rating_icon_g.png"); width: 25px; height: 28px; }
        .donepng { background-image: url("pictures/misc/rating_icon_g.png"); width: 25px; height: 28px; }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


 <asp:Accordion
    ID="Accordion0"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane1" runat="server">
            <Header><img src="/pictures/misc/picture_icon.png" /> Picture</Header>

   <Content>
   
    <asp:GridView ID="GridView2" runat="server" AllowPaging="False" 
        AllowSorting="False" AutoGenerateColumns="False" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" HorizontalAlign="Center">
        <Columns>
            <asp:ImageField DataImageUrlField="Picture" DataImageUrlFormatString="{0}" HeaderText="Avatar">
                <ControlStyle Height="150px" Width="200px" />
            </asp:ImageField>
        </Columns>
    </asp:GridView>
                   
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>
<br />

 <asp:Accordion
    ID="Accordion2"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane3" runat="server">
            <Header><img src="/pictures/misc/info_icon.png" /> Information</Header>

   <Content>

<asp:GridView ID="GridView1" runat="server" AllowPaging="False" 
        AllowSorting="False" AutoGenerateColumns="False" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" HorizontalAlign="Center" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" 
            CellPadding="4">
        <Columns>
            <asp:BoundField DataField="FoodUser" HeaderText="Username" 
                SortExpression="FoodUser" />
            <asp:BoundField DataField="FirstName" HeaderText="First Name" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Address" HeaderText="Address" 
                SortExpression="Address" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
        </Columns>
        
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#5078B3" Font-Bold="True" ForeColor="#FFFFCC" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />

    </asp:GridView>
      
    <br />
    
    <asp:GridView ID="GridView3" runat="server" AllowPaging="False" 
        AllowSorting="False" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource5" HorizontalAlign="Center" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" 
            CellPadding="4">
        <Columns>
                <asp:TemplateField HeaderText="Email">
                <ItemTemplate>
                <a href='mailto:<%# Eval("Email") %>'><%# Eval("Email")%>
                </a>
                </ItemTemplate>
                </asp:TemplateField>
        </Columns>
        
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#5078B3" Font-Bold="True" ForeColor="#FFFFCC" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />

    </asp:GridView>


   
<p>
<center>
    <asp:Button ID="btn_EditProfile" runat="server" 
        PostBackUrl="~/editProfile.aspx" Text="Edit Profile"  />
</center>
</p>             
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>


    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
        ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
        SelectCommand="SELECT [Email], [FoodUser] FROM [EmailFoodUser] WHERE ([FoodUser] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="FoodUser" QueryStringField="FoodUser" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
        SelectCommand="SELECT [ID], [FirstName], [LastName], [Description], [Picture], [FoodUser], [Address], [Email] FROM [profile] WHERE ([FoodUser] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="FoodUser" QueryStringField="FoodUser" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>


    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>



 
<asp:Accordion
    ID="Accordion1"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane2" runat="server">
            <Header><img src="/pictures/misc/info_icon.png" /> Rating</Header>

   <Content>

    <p>
        <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource3" 
            style="margin-bottom: 0px">
            <EditItemTemplate>
                AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageUserRating") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageUserRating") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                <strong>The current Average Rating for this user is
                <asp:Label ID="AverageRatingLabel" runat="server" style="color: #FF0000" 
                    Text='<%# Bind("AverageUserRating") %>' />
                </strong>. 

            </ItemTemplate>
                    </asp:FormView>
    <asp:PlaceHolder ID="ph_Rating" runat="server">
       <br />      <strong>Now it´s your turn, please rate him/her:</strong><br />
                <br />

        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
            SelectCommand="SELECT [AverageUserRating] FROM [AverageUserRating] WHERE ([FoodUser] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="FoodUser" QueryStringField="FoodUser" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
     <asp:Rating ID="Rating1" runat="server" CurrentRating="1" EmptyStarCssClass="emptypng" FilledStarCssClass="ratingpng" StarCssClass="ratingpng" WaitingStarCssClass="donepng">
    </asp:Rating>
    </p>
    <br />
       <p>
    <asp:Button ID="btn_SaveRating" runat="server" Text="Save Rating" />
    </p>

        <asp:Label ID="Label1" runat="server" 
                 Text="" 
                 BorderStyle="None" ForeColor="Red"></asp:Label>

       </asp:PlaceHolder>      
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>


</asp:Content>
